﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace Bug_Speed
{
    public partial class frmSearch : Form
    {
        public frmSearch()
        {
            InitializeComponent();
        }

        FrmTestCase fts = null;

        private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == 13)
            {

                try
                {

                    fts = new FrmTestCase();


                    SqlParameter[] sqlParams = new SqlParameter[]{
                                                     new SqlParameter("@caseID", textBox1.Text)
                                                    };
                    DataSet ds = new DataSet();

                    ds = SqlHelper.ExecuteDataset(Properties.Settings.Default.cnnstr, CommandType.StoredProcedure, "GetTestCaseByID", sqlParams);

                    if (ds.Tables[0].Rows.Count != 0)
                    {
                        fts.DS_CASE = ds;
                        fts.WindowState = FormWindowState.Normal;
                        fts.StartPosition = FormStartPosition.CenterScreen;
                        fts.Operation = FrmTestCase.OpAttribute.UPDATE;
                        fts.Show();
                    }
                    else
                    {
                        MessageBox.Show("无效的caseID");
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            //this.Close();
        }
    }
}
